 import store from '@/vuex/store.js'
 import {getmenu_list} from './getApi.js'



   function makeRouter(urls){
     if(!urls){
       return;
     }
     let role;
      if(store.state.role==1){
        role='ad'
      }else if(store.state.role==2){
         role='market'
      }else if(store.state.role==3){
         role='cloudlock_view'
      }
     urls.pop();
     const router1=JSON.parse(JSON.stringify(urls))
     const list1=router1.shift();
     const index=list1.url.split('/')[1];
     ///
     const tree={
       path:`/${index}`,
       //component: () => import('@/login/login')
       component:()=>import(`@/${role}/${index}`),
       children:[]
     }


     urls.forEach((item)=>{
       const com=item.url.split(`/${role}/`)[1];

       tree.children.push({
         path:com,
         component:()=>import(`@/${role}/${com}`)
       })

     })


      return tree;
  }

function formverify(obj,msg){
    for(let i in obj){
      if(obj[i]==''){
        console.log(msg[i])
         alert('请填写'+msg[i]);
         return;
      }
    }
}


export {makeRouter,formverify}
